<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="js/jquery.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>来自蜂窝煤的大佬们</title>
<link href="CSS/adminstyle.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#setinfodiv {
  height: 567px; 
  width:1100px;
  overflow-y:scroll;  /*纵向滚动条始终显示 */
  overflow-x:none;
 } 
 table {
  width: 1083px;   /*表格宽度＝div宽度(500px)－滚动条宽度(16px) */
 }
thead tr {
 position: relative;  TOP:0px;  /*绝对定位 */
 background:#cccccc;
}

tr {
 background:#cccccc;
}
.black_overlay{ 
display: none; 
position: absolute; 
top: 0%; 
left: 0%; 
width: 100%; 
height: 100%; 
background-color: black; 
z-index:1001; 
-moz-opacity: 0.8; 
opacity:.80; 
filter: alpha(opacity=88); 
} 
.white_content{ 
display: none; 
position: absolute; 
top: 25%; 
left: 25%; 
width: 55%; 
height: 55%; 
padding: 20px; 
border: 10px solid orange; 
background-color: white; 
z-index:1002; 
overflow: auto; 
} 

       
</style>
<script src="js/echarts.js"></script>
<script>
 function changecomplaint(op){
  $.getJSON("AdminServlet",{flag:"changecomplaint",complaintid:op},function(data){
   if(data=='修改失败'){
      alert("未能将改投诉的状态改变");
      document.getElementById('light').style.display='none';
      document.getElementById('fade').style.display='none';
   }else {
   var str = "<table cellpadding='10px'>"+
		  "<thead class='fixedThead'>"+
		  "<tr><th>投诉ID</th><th>投诉人</th><th>投诉时间</th><th>投诉状态</th><th></th></tr></thead>"+
		  "<tbody  class='scrollTbody'>";
			$.getJSON("AdminServlet",{flag:"setcomplaintinfo"},function(data){
			for(var i=0;i<data.length;i++){
			str = str +"<tr><td>"+data[i].complaint_id+"</td><td>"+data[i].complaint_user.user_name+"</td><td>"+
			data[i].complaint_time+"</td><td>"+data[i].complaint_status+"</td>"+
		   "<td style='text-align: center;'><a href='JavaScript:void(0)' onclick ='openDialog("+data[i].complaint_id+")'>"+
		   "<input type='button' value='详情'/></a></td></tr>";
			}
			str = str + "</tbody></table>";
			$("#setinfodiv").html(str);
			});
	  document.getElementById('light').style.display='none';
      document.getElementById('fade').style.display='none'
   }  
  });  	  
  }
        
</script>


<script type="text/JavaScript"> 
    function openDialog(op){ 
    $.getJSON("AdminServlet",{flag:"getonecomplaint",complaintid:op},function(data){   
	var str="<label>"+data.complaint_content+"</label><br/>"+
           "<div align='center'  style='width:94%; bottom:50px; position: fixed; position:absolute; margin:auto;'>"+
           "<input title='改变投诉状态' alt='改变投诉状态' type='button' value='确定'  onclick = 'changecomplaint("+op+")'/>"+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+
           "<input title='关闭该浮窗' alt='关闭该浮窗' type='button' value='关闭'  onclick = 'closeDialog()'/> </div></div>"
      	   "<div id='fade' class='black_overlay'>";
      $("#light").html(str);
      });
      document.getElementById('light').style.display='block';
      document.getElementById('fade').style.display='block'
   }
    function closeDialog(){
      document.getElementById('light').style.display='none';
      document.getElementById('fade').style.display='none'
  }
 
function getwhattodo(op){
if(op=="用户信息查询"){
var str = "<table  cellpadding='10px'>"+
		"<thead class='fixedThead'>"+
		"<tr><th>ID</th><th>用户名</th><th>性别</th><th>余额</th><th>身份</th><th>tel</th><th>注册时间</th></tr></thead>"+
		"<tbody  class='scrollTbody'>";

$.getJSON("AdminServlet",{flag:"setuserinfo"},function(data){
for(var i=0;i<data.length;i++){
str = str+"<tr><td>"+data[i].user_id+"</td><td>"+data[i].user_name+
		"</td><td>"+data[i].user_sex+"</td><td>"+data[i].user_money+
		"</td><td>"+data[i].user_status+"</td><td>"+data[i].user_tel+"</td><td>"+data[i].user_register+"</td></tr> "
}
str=str+"</tbody></table>";
$("#setinfodiv").html(str);
});
document.getElementById("setwhattodo").innerHTML=op;

}else if(op=="商家信息查询"){
var str = "<table  cellpadding='10px'>"+
		"<thead class='fixedThead'>"+
		"<tr><th>ID</th><th>商家</th><th>地址</th><th>余额</th><th>tel</th><th>注册时间</th></tr></thead>"+
		"<tbody  class='scrollTbody'>";

$.getJSON("AdminServlet",{flag:"setsellerinfo"},function(data){
for(var i=0;i<data.length;i++){
str = str+"<tr><td>"+data[i].seller_id+"</td><td>"+data[i].seller_name+
		"</td><td>"+data[i].seller_addr+"</td><td>"+data[i].seller_money+
		"</td><td>"+data[i].seller_tel+"</td><td>"+data[i].seller_register+"</td></tr> "
}
str=str+"</tbody></table>";
$("#setinfodiv").html(str);
});
document.getElementById("setwhattodo").innerHTML=op;
}else if(op=="攻略审核"){
var str = "<table cellpadding='10px'>"+
		  "<thead class='fixedThead'>"+
		  "<tr><th>攻略ID</th><th>投稿人</th><th>投稿时间</th><th>攻略地点</th><th></th></tr>"+
		  "</thead><tbody class='scrollTbody'>";
$.getJSON("AdminServlet",{flag:"setstrategyinfo"},function(data){
for(var i=0;i<data.length;i++){
str = str+"<tr><td>"+data[i].strategy_id+"</td><td>"+data[i].strategy_user.user_name+
          "</td><td>"+data[i].strategy_time+"</td><td>"+data[i].strategy_place.place_name+"</td>"+
		  "<td style='text-align: center;'>"+
		  "<a href='AdminServlet?flag=strategyinfo&strategyid="+data[i].strategy_id+"' target='_blank'>"+
		  "<input type='button' value='详情'/></a></td></tr>";
}
str=str+"</tbody> </table>";
$("#setinfodiv").html(str);
});	
document.getElementById("setwhattodo").innerHTML=op;
}else if(op=="投诉管理"){
var str = "<table cellpadding='10px'>"+
		  "<thead class='fixedThead'>"+
		  "<tr><th>投诉ID</th><th>投诉人</th><th>投诉时间</th><th>投诉状态</th><th></th></tr></thead>"+
		  "<tbody  class='scrollTbody'>";
$.getJSON("AdminServlet",{flag:"setcomplaintinfo"},function(data){
for(var i=0;i<data.length;i++){
str = str +"<tr><td>"+data[i].complaint_id+"</td><td>"+data[i].complaint_user.user_name+"</td><td>"+
			data[i].complaint_time+"</td><td>"+data[i].complaint_status+"</td>"+
		   "<td style='text-align: center;'><a href='JavaScript:void(0)' onclick = 'openDialog("+data[i].complaint_id+")'>"+
		   "<input type='button' value='详情'/></a></td></tr><div id='setcompcontent'></div>";
}
str = str + "</tbody></table>";
$("#setinfodiv").html(str);
});
document.getElementById("setwhattodo").innerHTML=op;
}else if(op=="用户注册统计"){
$.getJSON("AdminServlet",{flag:"getuserpojo"},function(data){
		var mydiv=document.getElementById("setinfodiv");
		var myecharts=echarts.init(mydiv);
		var myoption={
		title:{text:"用户注册趋势图"},
		tooltip:{show:true,trigger:"axis",axisPointer:{type:"cross"}},
		toolbox:[{show:true,feature:{
			saveAsImage:{},
			restore:{},
			magicType:{type:["line","bar"]},
			dataView:{readOnly :false}
		}}],
		legend:[{data:[{name:"用户注册趋势图",icon:"circle"}]}],
		xAxis:{type:"category",name:"月份",data:["一月","二月","三月","四月","五月","六月"]},
		yAxis:{name:"人数"},
		series:[{name:"用户注册趋势图",
				type:"line",
				 data:[data.Jan,data.Fed,data.Mar,data.Apr,data.May,data.Jun]
		}]
		};
		myecharts.setOption(myoption);
});
}else if(op=="商家入驻统计"){
$.getJSON("AdminServlet",{flag:"getsellerpojo"},function(data){
		var mydiv=document.getElementById("setinfodiv");
		var myecharts=echarts.init(mydiv);
		var myoption={
		title:{text:"商家入驻趋势图"},
		tooltip:{show:true,trigger:"axis",axisPointer:{type:"cross"}},
		toolbox:[{show:true,feature:{
			saveAsImage:{},
			restore:{},
			magicType:{type:["line","bar"]},
			dataView:{readOnly :false}
		}}],
		legend:[{data:[{name:"商家入驻趋势图",icon:"circle"}]}],
		xAxis:{type:"category",name:"月份",data:["一月","二月","三月","四月","五月","六月"]},
		yAxis:{name:"入驻商家数"},
		series:[{name:"商家入驻势图",
				type:"line",
				 data:[data.Jan,data.Fed,data.Mar,data.Apr,data.May,data.Jun]
		}]
		};
		myecharts.setOption(myoption);
});
}


}

function setuserinfo(){
var str = "<table  cellpadding='10px'>"+
		"<thead class='fixedThead'>"+
		"<tr><th>ID</th><th>用户名</th><th>性别</th><th>余额</th><th>身份</th><th>tel</th><th>注册时间</th></tr></thead>"+
		"<tbody  class='scrollTbody'>";

$.getJSON("AdminServlet",{flag:"setuserinfo"},function(data){
for(var i=0;i<data.length;i++){
str = str+"<tr><td>"+data[i].user_id+"</td><td>"+data[i].user_name+
		"</td><td>"+data[i].user_sex+"</td><td>"+data[i].user_money+
		"</td><td>"+data[i].user_status+"</td><td>"+data[i].user_tel+"</td><td>"+data[i].user_register+"</td></tr> "
}
str=str+"</tbody></table>";
$("#setinfodiv").html(str);
});
}

</script>
</head>

<body onload="setuserinfo()">
<div class="header">
	<div class="header03"></div>
	<div class="header01"></div>
	<div class="header02">注册用户信息管理系统</div>
</div>
<div class="left" id="LeftBox">
	<div class="left01">
		<div class="left01_right"></div>
		<div class="left01_left"></div>
		<div class="left01_c">超级管理员</div>
	</div>
	<div class="left02">
		<div class="left02top">
			<div class="left02top_right"></div>
			<div class="left02top_left"></div>
			<div class="left02top_c">信息管理</div>
		</div>
	  <div class="left02down">
			<div class="left02down01"><a href="javascript:;" onclick="getwhattodo('用户信息查询')">
			<div id="Bf080" class="left02down01_img"></div>用户信息查询</a></div>
			<div class="left02down01_xia noneBox" id="Bli080">

			</div>
		    <div class="left02down01"><a href="javascript:;" onclick="getwhattodo('商家信息查询')">
		      <div id="Bf081" class="left02down01_img"></div >商家信息查询</a></div>
			<div class="left02down01_xia noneBox" id="Bli081">
				
			</div>
		</div>
	</div>
	<div class="left02">
		<div class="left02top">
			<div class="left02top_right"></div>
			<div class="left02top_left"></div>
			<div class="left02top_c">用户分析</div>
		</div>
		<div class="left02down">
			<div class="left02down01"><a onclick="getwhattodo('用户注册统计')" href="javascript:;"><div id="Bf082" class="left02down01_img"></div>用户注册统计</a></div>
			<div class="left02down01"><a onclick="getwhattodo('商家入驻统计')" href="javascript:;"><div class="left02down01_img"></div>商家入驻统计</a></div>
		</div>
	</div>
	<div class="left02">
		<div class="left02top">
			<div class="left02top_right"></div>
			<div class="left02top_left"></div>
			<div class="left02top_c">审核管理</div>
		</div>
		<div class="left02down">
			<div class="left02down01"><a href="#" onclick="getwhattodo('攻略审核')"><div class="left02down01_img"></div>攻略审核</a></div>
			<div class="left02down01"><a href="#" onclick="getwhattodo('投诉管理')"><div class="left02down01_img"></div>投诉管理</a></div>
		</div>
	</div>
	
	<div class="left01">
		<div class="left03_right"></div>
		<div class="left01_left"></div>
		<div class="left03_c"><a href="AdminServlet?flag=endadmin">安全退出<a/></div>
	</div>
</div>
<div class="rrcc" id="RightBox">
	<div class="center" id="Mobile" onclick="show_menuC()"></div>
	<div class="right" id="li010" >
		<div class="right01"><img src="image/admin/04.gif" /><label id="setwhattodo">用户信息查询</label></div>
		<div id="setinfodiv" style="width:1000px; heigh:550px;">
		<div id="mydiv" style="width:1000px; heigh:550px;"></div>
		
		
		
		
		
		
		
		</div>
		<div id='light' class='white_content'></div>
	</div>

</div>



	

</body>
</html>
